

exports.get = function (key) {
  if (!key) {
    return null;
  }

  var val = wx.getStorageSync(key);
  if (val) {
    return JSON.parse(val);
  }

  return null;
}

exports.pop = function (key) {
  var obj = this.get(key);
  if (obj != null) {
    this.del(key);
    return obj;
  }
  return null;
}

exports.put = function (key, val) {
  if (!key) {
    return null;
  }

  wx.setStorageSync(key, JSON.stringify(val));
}

exports.del = function (key) {
  if (!key) {
    return null;
  }

  wx.setStorageSync(key, null);
}